package ${classPath};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; 

/**
 * @author APPLE
 *
 */
 
<#assign instance="${domain?substring(0,1)?lower_case}${domain?substring(1)}"/>

@Service
public class ${domain}ManagerImpl implements ${domain}Manager {
  private final static ${domain}Mapper MAPPER = ${domain}Mapper.INSTANCT;
  @Autowired
  private ${domain}Service ${instance}Service;

  @Override
  public ${domain}Dto create(${domain}AddCommand command) {
    ${domain}AddBo addBo = MAPPER.converCommand(command);
    
    ${domain} ${instance} = ${instance}Service.create(addBo);
    return MAPPER.converDto(${instance});
  }

  @Override
  public void edit(Long id, ${domain}EditCommand command) {
    ${domain}EditBo editBo = MAPPER.converCommand(command);
    
    ${instance}Service.edit(id, editBo);
  }

  @Override
  public Page<${domain}Dto> findAll(${domain}QueryDto queryDto, Pageable pageable) {
    ${domain}Query query = MAPPER.converQuery(queryDto);
    Page<${domain}> page = ${instance}Service.findAll(query.getSpecification(), pageable);
    return page.map(MAPPER::converDto);
  }


}
